package com.cskaoyan.service;

import com.cskaoyan.bean.MarketRegion;
import com.cskaoyan.bean.MarketRegionExample;
import com.cskaoyan.mapper.MarketRegionMapper;
import com.cskaoyan.util.MyBatisUtil;
import com.cskaoyan.util.TransactionUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author bianyonglei
 * @since 2023/05/27 14:47
 */

public class RegionServiceImpl implements RegionService {

    @Override
    public List<MarketRegion> getAll() {
        TransactionUtil.startTransaction();
        SqlSession sqlSession = TransactionUtil.getSqlSession();
        MarketRegionMapper regionMapper = sqlSession.getMapper(MarketRegionMapper.class);
        MarketRegionExample marketRegionExample = new MarketRegionExample();
        List<MarketRegion> marketRegions = regionMapper.selectByExample(marketRegionExample);
        System.out.println(marketRegions);
        sqlSession.close();
        return marketRegions;
        //return BaseRespVo.ok(CommonData.data(marketRegions));

    }
}
